import paramiko



ssh = paramiko.SSHClient()

ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
private_key = r'e:\xshell\Sessions\conf\InternalKey'
ssh.connect(hostname='192.168.0.120',port=22,username='root', key_filename=private_key)

stdin, stdout, stderr = ssh.exec_command('ls')

stdout = stdout.read().decode()
stderr = stderr.read().decode()
if stdout:
    print(stdout)
if stderr:
    print(stderr)


ssh.close()
